<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('业务填报对公类信息列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <li>
                        <label>机构名称：</label>
                        <input name="deptId" type="hidden" id="treeId"/>
                        <input name="deptName" onclick="selectDeptTree()" id="treeName" type="text"
                               placeholder="请选择归属机构" autocomplete="off">
                    </li>
                    <li>
                        <label>企业名称：</label>
                        <input type="text" name="pubEntName"/>
                    </li>
                    <li>
                        <label>联系方式：</label>
                        <input type="text" name="pubPhone"/>
                    </li>
                    <li>
                        <p>业务名称：</p>
                        <select id="busiCode" name="busiCode" onchange="busiCodeChange()"
                                th:with="type=${@busiReportConfig.selectEcardBusiReportConfigByBusiType('3')}">
                            <option th:each="dict : ${type}" th:text="${dict.busiName}"
                                    th:value="${dict.busiCode}"></option>
                        </select>
                    </li>
                    <li>
                        <label>营销经理：</label>
                        <input type="text" name="userName"/>
                    </li>
                    <li>
                        <label>员工号：</label>
                        <input type="text" name="userCode"/>
                    </li>
                    <li class="select-date">
                        <label>创建日期： </label>
                        <input type="text" class="time-input" id="startTime" placeholder="开始时间" readonly
                               name="params[startDate]"/>
                        <span>-</span>
                        <input type="text" class="time-input" id="endTime" placeholder="结束时间" readonly
                               name="params[endDate]"/>
                    </li>
                    <li>
                        <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                class="fa fa-search"></i>&nbsp;搜索</a>
                        <a class="btn btn-warning btn-rounded btn-sm" onclick="reset()"><i
                                class="fa fa-refresh"></i>&nbsp;重置</a>
                    </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="ecard:config:busiReportPublic:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()"
               shiro:hasPermission="ecard:config:busiReportPublic:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('ecard:config:busiReportPublic:view')}]];
    var removeFlag = [[${@permission.hasPermi('ecard:config:busiReportPublic:remove')}]];
    var pubDepositTypeDatas = [[${@dict.getType('ecard_busi_pub_deposit_type')}]];
    var pubDepositTermDatas = [[${@dict.getType('ecard_busi_pub_deposit_term')}]];
    var pubLoanTypeDatas = [[${@dict.getType('ecard_busi_pub_loan_type')}]];
    var pubLoanTermDatas = [[${@dict.getType('ecard_busi_pub_loan_term')}]];
    var prefix = ctx + "ecard/config/busiReportPublic";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "业务填报对公类信息",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'pubEntName',
                    title: '企业名称'
                },
                {
                    field: 'pubCreditCode',
                    title: '统一社会信用代码'
                },
                {
                    field: 'busiName',
                    title: '业务名称'
                },
                {
                    field: 'integralNums',
                    title: '积分'
                },
                {
                    field: 'pubContacts',
                    title: '联系人'
                },
                {
                    field: 'pubPhone',
                    title: '联系方式'
                },
                {
                    field: 'pubMarketingDate',
                    title: '营销日期'
                },
                {
                    field: 'creationTime',
                    title: '创建时间'
                },
                {
                    field: 'remark',
                    title: '备注说明'
                },
                {
                    field: 'userName',
                    title: '营销经理'
                },
                {
                    field: 'userCode',
                    title: '员工号'
                },
                {
                    field: 'deptName',
                    title: '归属机构'
                }]
        };
        $.table.init(options);
    });

    function busiCodeChange() {
        var busiCode = $("#busiCode").val();
        if (busiCode == 'busi_pub_mobile_banking' || busiCode == 'busi_pub_Intelligence_electronic'){
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "业务填报对公类信息",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'id',
                        title: 'ID',
                        visible: false
                    },
                    {
                        field: 'pubEntName',
                        title: '企业名称'
                    },
                    {
                        field: 'pubCreditCode',
                        title: '统一社会信用代码'
                    },
                    {
                        field: 'busiName',
                        title: '业务名称'
                    },
                    {
                        field: 'integralNums',
                        title: '积分'
                    },
                    {
                        field: 'pubContacts',
                        title: '联系人'
                    },
                    {
                        field: 'pubPhone',
                        title: '联系方式'
                    },
                    {
                        field: 'pubMarketingDate',
                        title: '营销日期'
                    },
                    {
                        field: 'creationTime',
                        title: '创建时间'
                    },
                    {
                        field: 'remark',
                        title: '备注说明'
                    },
                    {
                        field: 'userName',
                        title: '营销经理'
                    },
                    {
                        field: 'userCode',
                        title: '员工号'
                    },
                    {
                        field: 'deptName',
                        title: '归属机构'
                    }]
            };
            $.table.init(options);
        } else if (busiCode == 'busi_pub_International'){
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "业务填报对公类信息",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'id',
                        title: 'ID',
                        visible: false
                    },
                    {
                        field: 'pubEntName',
                        title: '企业名称'
                    },
                    {
                        field: 'pubCreditCode',
                        title: '统一社会信用代码'
                    },
                    {
                        field: 'busiName',
                        title: '业务名称'
                    },
                    {
                        field: 'integralNums',
                        title: '积分'
                    },
                    {
                        field: 'pubContacts',
                        title: '联系人'
                    },
                    {
                        field: 'pubPhone',
                        title: '联系方式'
                    },
                    {
                        field: 'pubSettlementAmount',
                        title: '结汇金额（美元）'
                    },
                    {
                        field: 'pubMarketingDate',
                        title: '营销日期'
                    },
                    {
                        field: 'creationTime',
                        title: '创建时间'
                    },
                    {
                        field: 'remark',
                        title: '备注说明'
                    },
                    {
                        field: 'userName',
                        title: '营销经理'
                    },
                    {
                        field: 'userCode',
                        title: '员工号'
                    },
                    {
                        field: 'deptName',
                        title: '归属机构'
                    }]
            };
            $.table.init(options);
        } else if (busiCode == 'busi_pub_loan'){
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "业务填报对公类信息",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'id',
                        title: 'ID',
                        visible: false
                    },
                    {
                        field: 'pubEntName',
                        title: '企业名称'
                    },
                    {
                        field: 'pubCreditCode',
                        title: '统一社会信用代码'
                    },
                    {
                        field: 'busiName',
                        title: '业务名称'
                    },
                    {
                        field: 'integralNums',
                        title: '积分'
                    },
                    {
                        field: 'pubContacts',
                        title: '联系人'
                    },
                    {
                        field: 'pubPhone',
                        title: '联系方式'
                    },
                    {
                        field: 'pubMarketingDate',
                        title: '营销日期'
                    },
                    {
                        field: 'pubLoanType',
                        title: '贷款类型',
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(pubLoanTypeDatas, value);
                        }
                    },
                    {
                        field: 'pubLoanAmount',
                        title: '贷款金额'
                    },
                    {
                        field: 'pubLoanTerm',
                        title: '贷款期限',
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(pubLoanTermDatas, value);
                        }
                    },
                    {
                        field: 'pubLoanRate',
                        title: '贷款利率'
                    },
                    {
                        field: 'creationTime',
                        title: '创建时间'
                    },
                    {
                        field: 'remark',
                        title: '备注说明'
                    },
                    {
                        field: 'userName',
                        title: '营销经理'
                    },
                    {
                        field: 'userCode',
                        title: '员工号'
                    },
                    {
                        field: 'deptName',
                        title: '归属机构'
                    }]
            };
            $.table.init(options);
        } else if (busiCode == 'busi_pub_deposit'){
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "业务填报对公类信息",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'id',
                        title: 'ID',
                        visible: false
                    },
                    {
                        field: 'pubEntName',
                        title: '企业名称'
                    },
                    {
                        field: 'pubCreditCode',
                        title: '统一社会信用代码'
                    },
                    {
                        field: 'busiName',
                        title: '业务名称'
                    },
                    {
                        field: 'integralNums',
                        title: '积分'
                    },
                    {
                        field: 'pubContacts',
                        title: '联系人'
                    },
                    {
                        field: 'pubPhone',
                        title: '联系方式'
                    },
                    {
                        field: 'pubMarketingDate',
                        title: '营销日期'
                    },
                    {
                        field: 'pubDepositType',
                        title: '存款类型',
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(pubDepositTypeDatas, value);
                        }
                    },
                    {
                        field: 'pubDepositAmount',
                        title: '存款金额'
                    },
                    {
                        field: 'pubDepositTerm',
                        title: '存款期限',
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(pubDepositTermDatas, value);
                        }
                    },
                    {
                        field: 'creationTime',
                        title: '创建时间'
                    },
                    {
                        field: 'remark',
                        title: '备注说明'
                    },
                    {
                        field: 'userName',
                        title: '营销经理'
                    },
                    {
                        field: 'userCode',
                        title: '员工号'
                    },
                    {
                        field: 'deptName',
                        title: '归属机构'
                    }]
            };
            $.table.init(options);
        }
        refreshTable(options);
    }

    function refreshTable(options) {
        $("#" + table.options.id).bootstrapTable('refreshOptions',options);
    }

    /* 选择机构树 */
    function selectDeptTree() {
        var treeId = $("#treeId").val();
        var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
        var url = ctx + "system/dept/selectDeptTree/" + deptId;
        var options = {
            title: '选择部门',
            width: "380",
            url: url,
            callBack: doSub
        };
        $.modal.openOptions(options);
    }

    function doSub(index, layero) {
        var body = $.modal.getChildFrame(index);
        $("#treeId").val(body.find('#treeId').val());
        $("#treeName").val(body.find('#treeName').val());
        $.modal.close(index);
    }

    function reset() {
        $('#treeId').val('')
        $.form.reset();
    }
</script>
</body>
</html>